Skip to content

[Spec 1951] Read-only PR check for architects: codev check pr | deploy | worktree - #1958

Draft
waleedkadous wants to merge 64 commits into
mainfrom
builder/spir-1951
Draft

waleedkadous wants to merge 64 commits into
mainfrom
builder/spir-1951

Conversation

@waleedkadous

@waleedkadous waleedkadous commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Draft, opened early for CI only. Under the owner's standing ruling main-32, GitHub's run on this head can stand in for porch's local tests check, which fails when the machine is under load (issue #1956). This is not ready for review.

Spec: codev/specs/1951-read-only-pr-check-for-archite.md. Plan: codev/plans/1951-read-only-pr-check-for-archite.md, 7 phases.

Committed so far:

Commits no reviewer has seen (look at these specifically)

Porch force-advanced Phase 2 (readonly_core) at its 3-iteration ceiling, so CMAP never re-reviewed the round-3 fix:

  • aa7e34f58:
    • The stub git's ls-remote accepts only origin, then HEAD or refs/… names.
    • An audit of every stub form that takes a path or URL. The stub now refuses path and URL arguments to the revision-taking subcommands, which closes an implicit --no-index diff of files outside the repository. ls-files and status take no arguments, and for-each-ref accepts refs/ patterns only.
    • A one-line liveTip branch-name guard.
  • c42251ec5: the ext:: refusal case no longer uses a /tmp path (the tmp-residue check).

Both commits are confined to commands/check/ test helpers, plus the one-line guard in git-facts.ts.

The full description comes at the pr gate.

Fixes #1951


Local tests check skipped once, under owner ruling main-32.

  • Phase 1 (forge_read_concepts), head bb2ad2710.

  • Porch's local tests check failed under machine load (tests: one run of the packages/codev unit suite takes an 18-core Mac from load 8 to 59, and its own spawn-heavy tests then time out #1956). The failing tests were unrelated to this change and each passed alone, and the builder's own full run passed.

  • The architect confirmed GitHub's run on this PR at bb2ad2710 was 8/8 green.

  • porch.checks.tests.skip was set in the worktree's own .codev/config.local.json for a single porch done and removed in the same command. It was never committed. The build check still ran and passed.

  • Phase 2 (readonly_core), head 9081d4367.

    • One porch done at load 9.5. Its tests check failed on four unrelated, spawn-heavy files: agy-auth-cache, windows-console-spawn-guard, pir-1233-session-launch-loop and bugfix-1267-launch-loop. Porch's output did not name them (porch done truncates failing check output; the failing test is never named #1853); vitest's results cache did.
    • Run alone in one invocation, all four passed.
    • The architect confirmed GitHub's run at 9081d4367 was 8/8 green. The skip was then applied once, in the same way, and the build check passed.
  • Phase 3 (check_pr_mechanics), head 5bef2f503, under owner ruling main-38 ("ci-first": no local full suite until tests: one run of the packages/codev unit suite takes an 18-core Mac from load 8 to 59, and its own spawn-heavy tests then time out #1956 is fixed).

    • No local full-suite run and no plain porch done. Locally: the targeted tests (551/551 in 14 files), the build and the type-check.
    • The architect confirmed GitHub's run at 5bef2f503 was 8/8 green. The skip was then applied once, in the same way, and the build check passed.
  • Phase 4 (check_pr_forge), head 410d5ec14, under the same ruling main-38.

    • No local full-suite run and no plain porch done. Locally: the targeted tests (644/644 in 17 files), the build, and the type-check on the source and on the check tests.

    • The architect confirmed GitHub's run at 410d5ec14 was 8/8 green. The skip was then applied once, in the same way, and the build check passed.

    • Review iteration 1 fixes, head e1cece6f6: targeted tests 664/664, build. The architect confirmed GitHub's run at e1cece6f6 was 8/8 green. The skip was then applied once, in the same way, and the build check passed.

  • Phase 5 (check_deploy), head 53f7e6522, under the same ruling main-38.

    • No local full-suite run and no plain porch done. Locally: the targeted tests (719/719 in 19 files), the build, and the type-check on the source and on the check tests.
    • The architect confirmed GitHub's run at 53f7e6522 was 8/8 green. The skip was then applied once, in the same way, and the build check passed.

… PR mechanics

- pr-view gains optional headRefOid, isDraft, mergeable, mergeStateStatus,
  mergeCommit, mergedAt, reviewDecision (github, gitlab, gitea)
- new read concepts commit-checks and workflow-runs: github implements them,
  gitlab and gitea disable them explicitly (no silent fall-through to gh)
- dispatcher: timeoutMs option and a timedOut flag on ForgeCommandError
- gitlab pr-view now captures before piping (#1645) and declares
  forge-executable: glab (#1455); it also maps body/baseRefName/headRefName
- forge.md documents the concepts and fields
…ab empty-output guard and body default, paginate legacy statuses
… settings, report core and git plumbing

- allow-list.ts: closed per-subcommand git grammar; diff/log/show forced to
  --no-ext-diff --no-textconv; ref-neutral fetch only; four read forge concepts
- runner.ts: the only subprocess path; argv spawn, GIT_TERMINAL_PROMPT=0,
  ls-remote/fetch and forge calls bounded, with its own deadline race
- validate.ts, roots.ts (roots from git), settings.ts (check.* with key+file on error)
- report.ts (schema 1, verdict, exit codes, check.skip, summarizeRuns), render.ts
- git-facts.ts: live tips, ensureCommits, ancestry, :(top,glob) pathspec filters
- test helpers: fixture repos with state snapshot, stub git/gh PATH recorders
- audited-imports test keeps child_process and the forge dispatcher in runner.ts
…ks arguments, not only flags

- stub ls-remote: origin only, then HEAD or refs/… names (no ::, no ..)
- stub revision-taking subcommands refuse path and URL arguments, closing the
  implicit --no-index diff of files outside the repository
- stub ls-files/status take no arguments before --; for-each-ref refs/ only
- shared refusal cases for all of the above, refused by both layers
- liveTip rejects an invalid branch name without running git
…echanics

- `codev check pr <N> [--json]`: anchors on the forge's head SHA and the
  live base tip (ls-remote), fetching missing objects ref-neutrally
- checks head (local branch vs PR head; compared only when origin's branch
  is the PR head, so a fork's PR is not misread), attribution, trial-merge
  (merge-tree --write-tree), watched/flagged, overlap, size, to-read
- re-reads pr-view and ls-remote at the end; a head or base that moved
  needs attention, even on a skipped check
- `codev check` group: help exits 0, usage errors exit 2, a --json usage
  error prints the ErrorReport
- tests: stub gh/git scenarios (POSIX), real-repo snapshots and races (all
  platforms), CLI wiring, parsers; fixes a type error in allow-list.test.ts
…e, CI on the code, linked issue

All eleven checks of `codev check pr` are now present:
- state: an open PR that is not a draft (OPENED → OPEN, a merge time → MERGED);
  a draft can never read CLEAR.
- forge: the verdict follows `mergeable` alone; the merge state and review decision
  are context; an UNKNOWN takes the end-of-run re-read once.
- checks (porch-only.ts): find the last code commit past porch-only commits (at most
  10), choose the code runs with at most 10 commit-checks lookups, and show code and
  head on two lines so "still running" reads apart from "failed".
- linked-issue (linked-issue.ts): GitHub's closing keywords against the builder
  branch's issue.

Phase 3 review fold-ins: commander exits throw CheckExit carrying their writes, and
cli.ts flushes them before exiting; `head` is attention when origin's branch is past
the forge head (a push the forge has not indexed); localBranchSha in the
not-origin-branch details; commander may be imported by index.ts only.
…t the walk and the forge did not provide

- forge: a merge state the forge did not report is said on the line,
  `MERGEABLE (merge state not reported)`; the verdict still follows `mergeable` alone.
- checks: a git call in the porch-only walk that fails leaves the check `not run`
  by name, and the other checks are still reported (was exit 2).
- The one-line form is chosen by SHA, not object identity.
- The walk's rev-list and two-revision diff-tree forms are in the shared form table.
- Tests: a pr-view without mergeStateStatus, a failing diff-tree, and main merged
  into a porch-only branch (C is the merge; main's commit is never looked up).
…n-branch, deploy-run, merge-checks

Per PR from pr-view: merged with a merge commit; the merge an ancestor of the
live tip of check.deploy.branch (else the PR's base); with check.deploy.workflow,
inside the newest green run of that workflow on the branch (workflow-runs), its
head fetched ref-neutrally when missing; without one, CI on the merge commit.
A PR that cannot be read is a per-PR not run; the verdict is the worst.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Read-only PR check for architects: merge readiness, deploy status, and whether a builder worktree can be removed

1 participant